var fs = require("fs");
var _ = require("lodash");

let fileNameC = "BuffDes";
let fileName1 = "Client_Buff";
let outputFileName = "./data/buff.json";

let mainData = JSON.parse(fs.readFileSync(`${fileNameC}.json`).toString()).map;
let data1 = JSON.parse(fs.readFileSync(`${fileName1}.json`).toString()).map;

let map1 = new Map();
_.forEach(data1, (e) => {
  let id = e.id;
  let data = e.data;
  map1.set(id, data);
});
_.forEach(mainData, (e) => {
  if (map1.has(e.id)) {
    _.assign(e.data, map1.get(e.id));
  }
});

fs.writeFileSync(outputFileName, JSON.stringify(mainData));
